<table border="0" class="tableborder3">
<?php
$CS=explode('#',$_SESSION['mac']);
$HJ=explode(',',$CS[1]);
$KD=explode(',',$CS[2]);
$AL=explode(',',$CS[3]);
$Column=count($HJ);//取的总列数
$query=$CS[0];
$result=sqlsrv_query($conn,$query);
$tp1='';
$mid=0;
$row=0;
while($line=sqlsrv_fetch_array($result))
{
$date[$line[1]]=$line[2];
}
$query="select CONVERT(varchar(10),dhrq,120),datediff(dd,dhrq,getdate()) from sys_jhdh a where a.lx in(2) ".$TJ2." group by dhrq order by dhrq";
$result=sqlsrv_query($conn,$query);
while($line=sqlsrv_fetch_array($result))
{
$shisje+=$date[$line[0]];
	$row=$row+1;
	echo "<tr>";
	echo "<td align=center width=25% height=22>".$line[0]."</td>";
	echo "<td align=right width=25%>".$date[$line[0]]."</td>";
	if($line=sqlsrv_fetch_array($result))
	{
	echo "<td align=center width=25% height=22>".$line[0]."</td>";
	echo "<td align=right width=25%>".$date[$line[0]]."</td>";
	$shisje2+=$date[$line[0]];
	}
	else
	{
	echo "<td>&nbsp;</td>";
	echo "<td align=right>&nbsp;</td>";
	}
	echo "</tr>";
}
sqlsrv_free_stmt($result);
?>
</table>